<div id="pop-compare" data-load="true" class="pop-compare" style="display: <?php echo ($contrast_media_list!=null&&!isset($_COOKIE ['contrast_status']))==true?"block":"none";?>; bottom: 0px;">
		<div class="pop-wrap">
			<p class="pop-compare-tips"></p>
			<div class="pop-inner" data-widget="tabs">
				<div class="diff-hd">
					<ul class="tab-btns clearfix">
						<li id="mc_menu" class="current" data-widget="tab-item">
							<a href="javascript:void(0);">对比栏</a>
						</li>
						<li id="mh_menu" data-widget="tab-item" class="">
							<a href="javascript:void(0);">最近浏览</a>
						</li>
					</ul>
					<div class="operate">
						<a href="javascript:void(0);" class="hide-me">隐藏</a>
					</div>
				</div>
				<div class="diff-bd tab-cons">
					<div id="mc" class="tab-con" data-widget="tab-content" style="display: block;">
						<div id="diff-items" class="diff-items clearfix">
							<?php 
								for ($i=0;$i<5;$i++){
									if (isset($contrast_media_list[$i])) {
									for ($j=0;$j<count($contrast_media_list);$j++){
									if ($contrast_media_list[$j]['media_id']==$contrast_media_id_list[$i]) {
							?>
							<dl class="hasItem" id="<?php echo $contrast_media_list[$j]['media_id']?>" >
								<dt>
									<a target="_blank" href="./media_detail?id=<?php echo $contrast_media_list[$j]['media_id']?>">
										<img src="<?php echo $this->config->item('ssi_pic_url').$contrast_media_list[$j]['pic']?>" >
									</a>
								</dt>
								<dd>
									<a target="_blank" class="diff-item-name"  href="./media_detail?id=<?php echo $contrast_media_list[$j]['media_id']?>">
										<?php echo  $contrast_media_list[$j]['location']?>
									</a>
									<a class="del-comp-item"  href="javascript:void(0);" >删除</a>
								</dd>
							</dl>
							<?php }
							}?>
							<?php }else{?>
							<dl class="item-empty">
								<dt><?php echo $i+1?></dt>
								<dd>您还可以继续添加</dd>
							</dl>			
								<?php }
								}
							?>
						</div>
						<div class="diff-operate">
							<a target="_blank" id="goto-contrast" href="./media_contrast" class="btn-compare-b compare-active">对比</a>
							<a class="del-items">清空对比栏</a>
						</div>
					</div>
					<div id="mh" class="tab-con" style="display: none;" data-widget="tab-content">
						<div class="scroll-item clearfix">
							<ul id="scroll-con-inner">
							<?php 
							for ($i=4;$i>=0;$i--){
								for ($j=0;$j<count($browse_history_media_list);$j++){
									if (isset($browse_history_id_list[$i])) {
									if ($browse_history_id_list[$i]==$browse_history_media_list[$j]['media_id']) {
							?>
							<li >
									<div class="<?php echo $i==0?"rec_item_wrap1":"rec_item_wrap"?>" >  
										<div class="dt">      
											<a target="_blank" href="<?php echo "./media_detail?id=".$browse_history_id_list[$i]?>">
												<img src="<?php echo $this->config->item('ssi_pic_url').$browse_history_media_list[$j]['pic']?>" >
											</a>  
										</div>  
										<div class="dd">      
											<a target="_blank" href="<?php echo "./media_detail?id=".$browse_history_id_list[$i]?>" class="diff-item-name">
											<?php echo $browse_history_media_list[$j]['location']?>
											</a>      
										</div>
									</div>
								</li>
							<?php 		}
									}
								}
							}
							?>
							</ul>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<script type="text/javascript">
	$(document).ready(function(){
		$("#mh_menu").click(function(){
			$("#mh").show();
			$("#mc").hide();
			$(this).addClass("current");
			$("#mc_menu").removeClass("current");
		});
		$("#mc_menu").click(function(){
			$("#mc").show();
			$("#mh").hide();
			$(this).addClass("current");
			$("#mh_menu").removeClass("current");
		});
		
		$(".hide-me").click(function(){
			$("#pop-compare").hide();
			$.getJSON("<?php echo base_url()."index.php/media/contrast_status"?>", { status: "-1" }, function(json){
			});
		});
		$(document).on("click",".del-comp-item",function(){
			$(this).parent().parent().remove();
			$("#diff-items").append("<dl class='item-empty'>"+
										"<dt></dt>"+
										"<dd>您还可以继续添加</dd>"+
									"</dl>");	
			var id =$(this).parent().parent().attr("id");
			$(".btn-compare").each(function(){
				if ($(this).attr("id")==id) {
					$(this).removeClass("btn-compare-s-active");
				}
			});
			$.getJSON("<?php echo base_url()."index.php/media/add_contrast_media"?>", { media_id: id }, function(json){
			});
			order_db_num();
		});
		$(".btn-compare").click(function(){
			$.getJSON("<?php echo base_url()."index.php/media/contrast_status"?>", { status: "" }, function(json){
			});
		var media_id 	= $(this).attr("id");
		$.getJSON("<?php echo base_url()."index.php/media/add_contrast_media"?>", { media_id: media_id }, function(json){
		});
		if($(this).hasClass("btn-compare-s-active")){
			var no_db =$("#diff-items").find("#"+media_id);
			$(this).removeClass("btn-compare-s-active");
			no_db.remove();
			$("#diff-items").append("<dl class='item-empty'>"+
										"<dt></dt>"+
										"<dd>您还可以继续添加</dd>"+
									"</dl>");
			order_db_num();
			$.getJSON("<?php echo base_url()."index.php/media/add_contrast_media"?>", { media_id: media_id }, function(json){
			});
		}else{
			$("#pop-compare").show();
			var media_name	= $(this).parent().parent().parent().find(".media_title").text();
			var media_link	= $(this).parent().parent().parent().find("a").attr("href");
			var img		 	= $(this).parent().parent().parent().find("img").attr("src");
			var db_num 		= $(".hasItem").size();
			if(db_num<5){
				var to_db =$(".item-empty").first();
				$(this).addClass("btn-compare-s-active");
				to_db.removeClass("item-empty");
				to_db.addClass("hasItem");
				to_db.attr("id",media_id);
				to_db.html("<dt>"+
								"<a target='_blank' href='"+media_link+"'>"+
									"<img src='"+img+"' >"+
								"</a>"+
							"</dt>"+
							"<dd>"+
								"<a target='_blank' class='diff-item-name' href='"+media_link+"'>"+
									media_name+
								"</a>"+
								"<a class='del-comp-item' >删除</a>"+
							"</dd>");
			}else{
				alert("您最多只能添加5个媒体到对比栏");
			}
		}
   	 });
   	 //对比清空特效
	$(".del-items").click(function(){
		$(".btn-compare").each(function(){
			$(this).removeClass("btn-compare-s-active");
		});
		$("#diff-items").html("");
		for(i=0;i<=5;i++){
			$("#diff-items").append("<dl class='item-empty'>"+
					"<dt></dt>"+
					"<dd>您还可以继续添加</dd>"+
				"</dl>");
			order_db_num();
			
		}
		$.getJSON("<?php echo base_url()."index.php/media/add_contrast_media"?>", { media_id: "-1" }, function(json){
		});
	});
   	 
   	 function order_db_num(){
   		 var i=0;
   		 $("#diff-items").find("dl").each(function(){
   			 i =i+1;
   			if($(this).hasClass("item-empty")) {
   				$(this).find("dt").html(i);
   			}
   		 });
   		 
   	 }
   	});
</script>